package net.scalan.jpa.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

@Entity
public class DBTypeOfModuleContact implements Serializable {

    private static final long serialVersionUID = 1L;

    //==========================================================================
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    //==========================================================================
    @Column
    private String name;

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }
    
    //==========================================================================
    @Column
    private Integer npp;

    /**
     * @return the npp
     */
    public Integer getNpp() {
        return npp;
    }

    /**
     * @param npp the npp to set
     */
    public void setNpp(Integer npp) {
        this.npp = npp;
    }

    //==========================================================================
    @ManyToOne
    private DBTypeOfModule type;

    /**
     * @return the type
     */
    public DBTypeOfModule getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(DBTypeOfModule type) {
        this.type = type;
    }

    //==========================================================================
    @Transient
    private int value;
    
    /**
     * @return the value
     */
    public int getValue() {
        return value;
    }

    /**
     * @param value the value to set
     */
    public void setValue(int value) {
        this.value = value;
    }

    //==========================================================================
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DBTypeOfModuleContact)) {
            return false;
        }
        DBTypeOfModuleContact other = (DBTypeOfModuleContact) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.scalan.jpa.model." + this.getClass().getName() + "[id=" + id + "]";
    }
}
